home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Internet Tools 1993 July / Internet Tools.iso / RockRidge / mail / mm / ccmd / incversion.c < prev    next >
Encoding:
C/C++ Source or Header  |  1990-12-18  |  1.1 KB  |  42 lines

  1. /*
  2.  Copyright (c) 1986, 1990 by The Trustees of Columbia University in
  3.  the City of New York.  Permission is granted to any individual or
  4.  institution to use, copy, or redistribute this software so long as it
  5.  is not sold for profit, provided this copyright notice is retained.
  6.  
  7.  Author: Howie Kaye
  8. */
  9.  
  10. #include <stdio.h>
  11.  
  12. #define MAJSTRING "#define MAJORVERSION"
  13. #define MINSTRING "#define MINORVERSION"
  14. #define DATSTRING "#define VERSIONDATE"
  15.  
  16. char *ctime();
  17.  
  18. main(argc, argv) int argc; char **argv; {
  19.   int maj_len, min_len, dat_len;
  20.   char line[100];
  21.  
  22.   maj_len = strlen(MAJSTRING);
  23.   min_len = strlen(MINSTRING);
  24.   dat_len = strlen(DATSTRING);
  25.  
  26.   while(fgets(line, 100, stdin) != NULL) {
  27.     if (strncmp(line,MINSTRING,maj_len) == 0) {
  28.       int newversion = atoi(&line[min_len]) + 1;
  29.       fprintf(stdout, "#define MINORVERSION %d\n",newversion);
  30.     }
  31.     else if (strncmp(line,DATSTRING,dat_len) == 0) {
  32.       long t = time(0);
  33.       char *cp = ctime(&t);
  34.       cp[strlen(cp)-1] = '\0';
  35.       
  36.       fprintf(stdout, "#define VERSIONDATE \"%s\"\n", cp);
  37.     }
  38.     else 
  39.       fprintf(stdout,"%s",line);
  40.   }
  41. }
  42.